//
//  MKTChatItem_1_TVCell.m
//  MKUITestApp
//
//  Created by 苏尚进 on 2021/7/9.
//  Copyright © 2021 moon. All rights reserved.
//

#import "MKTChatItem_1_TVCell.h"

@implementation MKTChatItem_1_TVCell
+ (void)load{
    [self registerTableViewCellFor:[MKTChatItem_1 class]];
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.itemTitleLabel = [[UILabel alloc] init];
        self.itemTitleLabel.font = [UIFont systemFontOfSize:12];
        self.itemTitleLabel.numberOfLines = 1;
        self.itemTitleLabel.textAlignment = NSTextAlignmentLeft;
        self.itemTitleLabel.textColor = [UIColor mk_colorWithLight:[UIColor blackColor] dark:[UIColor whiteColor]];
        [self.contentView addSubview:self.itemTitleLabel];
        self.flowlayout = [[MKUIFlowLayoutConstraint alloc] initWithItems:@[self.itemTitleLabel] constraintParam:(MKUIFlowLayoutConstraintParam_H_C_L) contentInsets:MKUIEdgeInsetsMakeSameEdge(10) interitemSpacing:5];
    }
    return self;
}
- (void)customLayoutSubviews{
    [super customLayoutSubviews];
    CGRect bounds = self.contentView.bounds;
    self.flowlayout.bounds = bounds;
    [self.flowlayout layoutItemsWithResizeItems:YES];
}
- (void)customReloadCellModel{
    [super customReloadCellModel];
    MKTChatItem_1 *item = self.item;
    self.itemTitleLabel.text = item.itext;
}
- (CGSize)customSizeThatFits:(CGSize)size{
    return [self.flowlayout sizeThatFits:size resizeItems:YES];
}
@end
